import { http } from '@/utils/http/axios';

/**
 * @description: 获取字典列表
 */
export function dictionarysList(data?) {
  return http.request({
    url: '/dictionarys/search',
    method: 'post',
    data,
  });
}

/**
 * @description: 获取字典详情
 */
export function dictionaryInfo(id) {
  return http.request({
    url: `/dictionary/${id}`,
    method: 'get',
  });
}

/**
 * @description: 添加字典
 */
export function addDictionary(data) {
  return http.request({
    url: '/dictionary',
    method: 'post',
    data,
  });
}

/**
 * @description: 编辑字典
 */
export function editDictionary(data) {
  return http.request({
    url: '/dictionary',
    method: 'PATCH',
    data,
  });
}

/**
 * @description: 删除字典
 */
export function deleteDictionary(ids) {
  return http.request({
    url: `/dictionary/${ids}`,
    method: 'delete',
  });
}

/**
 * @description: 添加字典数据项
 */
export function addDictionaryData(data) {
  return http.request({
    url: '/dictionaryData',
    method: 'post',
    data,
  });
}

/**
 * @description: 编辑字典数据项
 */
export function editDictionaryData(data) {
  return http.request({
    url: '/dictionaryData',
    method: 'PATCH',
    data,
  });
}

/**
 * @description: 获取字典数据项
 */
export function dictionaryDataInfo(id) {
  return http.request({
    url: `/dictionaryData/${id}`,
    method: 'get',
  });
}

/**
 * @description: 获取字典数据项列表
 */
export function dictionaryDataList(id) {
  return http.request({
    url: `/dictionaryDatas/${id}`,
    method: 'get',
  });
}

/**
 * @description: 删除字典数据项
 */
export function deleteDictionaryData(ids) {
  return http.request({
    url: `/dictionaryData/${ids}`,
    method: 'delete',
  });
}
